#include "FbxConverter.h"

namespace GC
{
	FbxConverter::FbxConverter(const _TCHAR* a_inputName, const _TCHAR* a_outputName)	
	{
		m_importer = FbxImporterPtr( new GC::FbxImporter(a_inputName));
		m_exporter = FbxExporterPtr(new GC::FbxExporter(a_outputName));
	}

	FbxConverter::~FbxConverter()
	{
		
	}

	const bool FbxConverter::Run()
	{	
		//Check if import the fbx model works!
		if (Import() )
		{
			//Try to export the model
			return Export();
		}

		return false;
	}
	
	const bool FbxConverter::Import()
	{
		if (m_importer == nullptr) return false;

		return m_importer->Import();
	}

	const bool FbxConverter::Export()
	{
		if (m_exporter == nullptr) return false;		

		return m_exporter->ExportToFile( m_importer->GetData(), GC::FbxExporter::ExportFormat::Json);
	}
}